#ifndef PROTACTORTOOLVIEW_H_KKQQXXGHIU
#define PROTACTORTOOLVIEW_H_KKQQXXGHIU

#include "../../../../kegui_global.h"



#include "mcore/map/MapObject.h"

#include "mcore/tools/protactor/ProtactorParamData.h"
#include "mcore/tools/protactor/SegmentPickedData.h"
#include "mcore/tools/protactor/ProtractorPickTool.h"

#include "kesyssetting.h"

#include <QVBoxLayout>
#include <QWidget>
#include <QPaintEvent>
#include <QFont>
#include <QPointF>
#include <QLineEdit>

#include <geos.h>

namespace kepen {
namespace core {


class ProDlgHead;
class KEGUI_EXPORT ProtactorToolView : public QVBoxLayout
{
    Q_OBJECT
public:
    ProtactorToolView(QWidget *parent,int lineOrPolygon,KeSysSetting *config);
    ~ProtactorToolView();
public:
    int onComboxClicked(int id,int flag,const QPoint &point);
    int onBtnClicked(int id);
    void repaintToolBar();
    void testTimer();
    void testAngle();

    double getAngleValue();

    KeSysSetting *getSysConfig();
private:
    void onClickedPickVertex(int id);
    void onClickedPickSegment(int id);
    void onEditToolSelectedImpl(int id);
    void pickSegmentToolImpl();
    void pickVertexToolImpl();
    void data2view();
    void isValChanged(ProtactorParamEdit &paramEdited);

    void goView4Vertex();
    void goView4Segment();
    void clearViewVertex();



    void onUpdateGPSByString();
    void onEditEraseVertex();

    void actEditTool(int id,bool checkView);
private Q_SLOTS:
    void onSelectedEditTool(QWidget *dlg,int id);

    void timeoutClosedThiz();
    void onPickProtractorHandler(ProtractorPickTool *tool);

    void onProtractorWrite();
    void onGPSWrite();
    void writeGPSImpl(double x,double y);
    bool tyrParsePointCoords(double &x,double &y);

    void onPickVertexHandler();
Q_SIGNALS:
    void onViewTabClosedSignals(QLayout *dlg);

public:
    const int m_LineTag;
    KeSysSetting *sysConfig;
    double angleTest;

    QFont fontLabel;
    QFont thirdFontIcon;

    kepen::core::MapObject *mapSurface;
    ProDlgHead* dlgHead;
    QWidget* m_BodyWidget;

    QLineEdit *m_AngleInput;
    QLineEdit *m_SegInput;
    QLineEdit *m_SegR2Input;

    QLineEdit *m_gpsInput;
    SegmentPickedData* segmentPicked;





};


}
}
#endif // PROTACTORTOOLVIEW_H
